# Maintainer: Dylan Van Assche <me@dylanvanassche.be>
pkgname=hexagonrpcd
pkgver=0.1.0
pkgrel=0
pkgdesc="Qualcomm HexagonFS daemon"
url="https://gitlab.com/flamingradian/sensh/"
arch="all"
license="GPL-3.0-or-later"
makedepends="linux-headers meson"
install="$pkgname.pre-install"
subpackages="$pkgname-openrc"
source="https://gitlab.com/flamingradian/sensh/-/archive/v$pkgver/sensh-v$pkgver.tar.gz
	noshared.patch
	10-fastrpc.rules
	$pkgname-adsp-rootpd.initd
	$pkgname-adsp-sensorspd.initd
	$pkgname-sdsp.initd
	"
builddir="$srcdir/sensh-v$pkgver/fastrpc"
options="!check" # no tests

build() {
	abuild-meson \
		-Db_lto=true \
		. output
	meson compile -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output

	# Allow access for FastRPC node for FastRPC user/group
	install -Dm 644 "$srcdir"/10-fastrpc.rules -t "$pkgdir"/usr/lib/udev/rules.d/

	install -Dm755 "$srcdir"/$pkgname-adsp-rootpd.initd "$pkgdir"/etc/init.d/$pkgname-adsp-rootpd
	install -Dm755 "$srcdir"/$pkgname-adsp-sensorspd.initd "$pkgdir"/etc/init.d/$pkgname-adsp-sensorspd
	install -Dm755 "$srcdir"/$pkgname-sdsp.initd "$pkgdir"/etc/init.d/$pkgname-sdsp
}


sha512sums="
130cbaeacc99e69189d60bdcd748c3554317615ae6cbf76cf49d62036c7fa7ed8fdfcba48455a5fd9345c133e6c1a3f9a628c9de53d82963ab6627f762023cf6  sensh-v0.1.0.tar.gz
271be1fd15b864ef5a6e2a44279f1cce3079f2279b4527c0b3ddf0a957941cc8013593dacb6764196de1a12a9dcd3adbb6457be45bddae7c211db88c8837e9e0  noshared.patch
f931cf5f901a7c17ffb0eb194b5de2c532fd238692898bf264c484b13b93119c9727bd8f8daf6a7d1668cc9108a9a0662231d300c6f1376e3e4edd3ce41d235d  10-fastrpc.rules
a3eafd8eb350920db272fe859abfba0223f5d656dd56bd2af20b9340923fbc1b0249b9fd535fb648a69c9deb85d1bee1a7381986208e37170ba6f029c0d5d277  hexagonrpcd-adsp-rootpd.initd
70107100fb0ffcd43348b3ac96d63c3e8789039e507383cfd756ddcaebb57b3f985145ff554974577f23b4f7fd11b53d5c314297c8a3f3e50b4954d48a5c3e2c  hexagonrpcd-adsp-sensorspd.initd
2ee1ff904b22da382ceb059ca8c7c8ac9271d4c6724dd3155b473be94f1850d3ae0ec97226b1aae440c58632e7061205b598d62d80f066cc36c52c3d37dc55a2  hexagonrpcd-sdsp.initd
"
